//
//  HMBaseVistorTableViewController.swift
//  WeiBo
//
//  Created by 李立达 on 15/12/6.
//  Copyright © 2015年 heima11. All rights reserved.
//

import UIKit

class HMBaseVistorTableViewController: UITableViewController {

    
    var islogin = HMusercount.shareuserCount.accessToken != nil
    
    var visitorView : HMVisitorView?
    
    override func loadView() {
        
        islogin ? super.loadView() : setupView()
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
    }

    
   private func setupView() {
    
        visitorView = HMVisitorView()
        
        visitorView?.reginenor.addTarget(self, action: "Login", forControlEvents: UIControlEvents.TouchUpInside)
        
        visitorView?.loginButton.addTarget(self, action: "Login", forControlEvents: UIControlEvents.TouchUpInside)
        
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem( title: "注册", target: self, anction: "Login")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem( title: "登录", target: self, anction: "Login")
        
    }
   @objc private func Login () {
    
       let oauthvc = HMOauthViewController()
    
    
        presentViewController(HMNavigationViewController(rootViewController: oauthvc), animated: true, completion: nil)
    }
    
}
